package entity;

import entity.state.book.AvailableState;
import entity.state.book.BookState;
import java.util.Observable;

/**
 * @version 1.0
 * @created 11-Apr-2011 15:54:45
 */
public class Book extends Observable {

    private BookState state;
    private String author;
    private int id;
    private String title;
    private User lentTo;
    private User reservedBy;

    public Book() {
        state = new AvailableState();
    }

    public String getAuthor() {
        return author;
    }

    public int getId() {
        return id;
    }

    public String getTitle() {
        return title;
    }

    /**
     *
     * @param author
     */
    public void setAuthor(String author) {
        this.author = author;
        setChanged();
        notifyObservers();
    }

    /**
     *
     * @param id
     */
    public void setId(int id) {
        this.id = id;
        setChanged();
        notifyObservers();
    }

    /**
     *
     * @param title
     */
    public void setTitle(String title) {
        this.title = title;
        setChanged();
        notifyObservers();
    }

    /**
     * @return the lentTo
     */
    public User getLentTo() {
        return lentTo;
    }

    /**
     * @param user the lentTo to set
     */
    public void setLentTo(User user) {
        this.lentTo = user;
        setChanged();
        notifyObservers();
    }

    /**
     * @return the reservedBy
     */
    public User getReservedBy() {
        return reservedBy;
    }

    /**
     * @param reservedBy the reservedBy to set
     */
    public void setReservedBy(User reservedBy) {
        this.reservedBy = reservedBy;
        setChanged();
        notifyObservers();
    }

    /**
     * @return the state
     */
    public BookState getState() {
        return state;
    }

    /**
     * @param state the state to set
     */
    public void setState(BookState state) {
        this.state = state;
        setChanged();
        notifyObservers();
    }
}
